package com.newgrand.service.impl;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @Author: zhanglixin
 * @Data: 2023/6/24 21:15
 * @Description: TODO
 */

@Configuration
public class TopicRabbitConfig {
    //队列 起名：TestDirectQueue
    @Bean
    public Queue Pcm3CntChangeQueue() {
        return new Queue("pcm3cntchange_ng",true);
    }
    //Direct交换机 起名：TestDirectExchange
    @Bean
    DirectExchange Pcm3CntChangeExchange() {
        return new DirectExchange("pcm3cntchange_ng_exchange");
    }
    //绑定  将队列和交换机绑定, 并设置用于匹配键：TestDirectRouting
    @Bean
    Binding bindingPcm3CntChange() {
            return BindingBuilder.bind(Pcm3CntChangeQueue()).to(Pcm3CntChangeExchange()).with("pcm3cntchange_ng_routing");
    }
    @Bean
    public Queue Pcm3CntPayQueue() {
        return new Queue("pcm3cntpay_ng",true);
    }

    //Direct交换机 起名：TestDirectExchange
    @Bean
    DirectExchange Pcm3CntPayExchange() {
        return new DirectExchange("pcm3cntpay_ng_exchange");
    }
    //绑定  将队列和交换机绑定, 并设置用于匹配键：TestDirectRouting
    @Bean
    Binding bindingPcm3CntPay() {
        return BindingBuilder.bind(Pcm3CntPayQueue()).to(Pcm3CntPayExchange()).with("pcm3cntpay_ng_routing");
    }
    @Bean
    DirectExchange lonelyDirectExchange() {
        return new DirectExchange("lonelyDirectExchange");
    }
}

